package com.ityueqiangu.system.service.impl;

import java.util.Date;
import java.util.List;

import com.ityueqiangu.core.util.Convert;
import com.ityueqiangu.system.domain.UserChat;
import com.ityueqiangu.system.mapper.UserChatMapper;
import com.ityueqiangu.system.service.IUserChatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 聊天内容Service业务层处理
 *
 * @author yueqiangu
 * @date 2021-04-07
 */
@Service
public class UserChatServiceImpl implements IUserChatService
{
    @Autowired
    private UserChatMapper userChatMapper;

    /**
     * 查询聊天内容
     *
     * @param id 聊天内容ID
     * @return 聊天内容
     */
    @Override
    public UserChat selectUserChatById(Long id)
    {
        return userChatMapper.selectUserChatById(id);
    }

    /**
     * 查询聊天内容列表
     *
     * @param userChat 聊天内容
     * @return 聊天内容
     */
    @Override
    public List<UserChat> selectUserChatList(UserChat userChat)
    {
        return userChatMapper.selectUserChatList(userChat);
    }

    /**
     * 新增聊天内容
     *
     * @param userChat 聊天内容
     * @return 结果
     */
    @Override
    public int insertUserChat(UserChat userChat)
    {
        userChat.setCreateTime(new Date());
        return userChatMapper.insertUserChat(userChat);
    }

    /**
     * 修改聊天内容
     *
     * @param userChat 聊天内容
     * @return 结果
     */
    @Override
    public int updateUserChat(UserChat userChat)
    {
        return userChatMapper.updateUserChat(userChat);
    }

    /**
     * 删除聊天内容对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteUserChatByIds(String ids)
    {
        return userChatMapper.deleteUserChatByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除聊天内容信息
     *
     * @param id 聊天内容ID
     * @return 结果
     */
    @Override
    public int deleteUserChatById(Long id)
    {
        return userChatMapper.deleteUserChatById(id);
    }
}
